﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;
using XinYi.CrookedShowMode;

namespace XinYi.CrookedShow.Models
{
    /// <summary>
    /// 管理员的上下文
    /// </summary>
    public class UserInfoContext
    {
        /// <summary>
        /// 会话的key
        /// </summary>
        private string SessionKey = "ADMIN_KEY";

        /// <summary>
        /// 静态的上下文
        /// </summary>
        public static UserInfoContext adminContext = new UserInfoContext();

        /// <summary>
        ///会话状态
        /// </summary>
        public HttpSessionState httpSessionState => HttpContext.Current.Session;

        /// <summary>
        /// 用户对象
        /// </summary>
        public UserInfo adminInfo
        {
            get
            {
                return httpSessionState[SessionKey] as UserInfo;
            }
            set
            {
                httpSessionState[SessionKey] = value;
            }
        }
    }
}